{extend name="template/base" /}
{block name="content"}
<!--select2样式 start -->
<link href="__LIB__/select2-4.0.3/dist/css/select2.min.css" rel="stylesheet" />
<br><br><br>
<div class="page-container">
    <form class="form form-horizontal" id="form" method="post" action="{:\\think\\Request::instance()->baseUrl()}">
        <input type="hidden" name="id" value="{$vo.id ?? ''}">
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>司机姓名：</label>
            <div class="formControls col-xs-6 col-sm-6">
                {foreach $admin_user as $re}
                {$re.realname ?? ''}
                {/foreach}
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>组合旅客姓名：</label>
            <div class="formControls col-xs-6 col-sm-6">
                {foreach $list_data as $v}
                    {if $v['id'] == $vo['id']}
                        <td>{$v.booking_people_name}</td>
                    {/if}
                {/foreach}
                {if empty($vo['order_travel_ids']) && !empty($vo['name_of_passenger'])}
                {$vo.name_of_passenger}
                {/if}
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>入住日期：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text Wdate" autocomplete="off" placeholder="入住日期" name="check_in_date" value="{$vo.check_in_date ?date('Y-m-d',$vo['check_in_date']): ''}" {literal} onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" {/literal}  datatype="*" nullmsg="入住日期不能为空" errormsg="入住日期格式错误">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>结束日期：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <input type="text" class="input-text Wdate" autocomplete="off" placeholder="结束日期" name="end_date" value="{$vo.end_date ?date('Y-m-d',$vo['end_date']): ''}" {literal} onfocus="WdatePicker({dateFmt:'yyyy-MM-dd'})" {/literal}  datatype="*" nullmsg="结束日期不能为空" errormsg="结束日期格式错误">
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>是否已结算：</label>
            <div class="formControls col-xs-6 col-sm-6 skin-minimal">
                <div class="radio-box">
                    <input type="radio" name="is_settlement" id="order_status-pay_for" {if($vo[is_settlement] == 1)} checked {/if} value="1" datatype="*">
                    <label for="order_status-pay_for">已结算</label>
                </div>
                <div class="radio-box">
                    <input type="radio" name="is_settlement" id="order_status-pending"  {if($vo[is_settlement] == 0)} checked {/if} value="0">
                    <label for="order_status-pending">未结算</label>
                </div>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>出行路线：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="route_id" id="route_id" class="select2" datatype="*" nullmsg="出行路线不能为空">
                    {if empty($vo['route_id'])}
                    <option value="">请选择出行路线</option>
                    {/if}
                    {foreach $route as $vo2}
                    <option {if ($vo2['id'] == $vo['route_id'])} selected {/if} value="{$vo2.id}">{$vo2.id}:{$vo2.title}</option>
                    {/foreach}
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>酒店名称：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="hotel_id" id="hotel_id" class="select2" datatype="*" nullmsg="酒店名称不能为空" onchange="getRoomType()">
                    {if empty($vo['hotel_id'])}
                    <option value="">请选择酒店</option>
                    {/if}
                    {foreach $hotel as $vo2}
                    <option {if ($vo2['id'] == $vo['hotel_id'])} selected {/if} value="{$vo2.id}">{$vo2.id}:{$vo2.hotel_name}</option>
                    {/foreach}
                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3"><span class="c-red">*</span>酒店房型：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <select name="hotel_room_type" id="hotel_room_type" class="select2" datatype="*" nullmsg="酒店房型不能为空">
                    {if empty($vo['hotel_room_type'])}
                    <option value="">请选择酒店房型</option>
                    {/if}
                    {foreach $hotel_room_type as $vo2}
                    <option {if ($vo2['id'] == $vo['hotel_room_type'])} selected {/if} value="{$vo2.id}">{$vo2.room_name}</option>
                    {/foreach}

                </select>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>
        <div class="row cl">
            <label class="form-label col-xs-3 col-sm-3">备注：</label>
            <div class="formControls col-xs-6 col-sm-6">
                <textarea class="textarea" placeholder="备注" name="remark" value="{$vo.remark ?? ''}" >{$vo.remark ?? ''}</textarea>
            </div>
            <div class="col-xs-3 col-sm-3"></div>
        </div>


        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <button type="submit" class="btn btn-primary radius">&nbsp;&nbsp;提交&nbsp;&nbsp;</button>
                <button type="button" class="btn btn-default radius ml-20" onClick="layer_close();">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
            </div>
        </div>
    </form>
</div>
{/block}
{block name="script"}
<script type="text/javascript" src="__LIB__/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript" src="__LIB__/select2-4.0.3/dist/js/select2.min.js"></script>
<script type="text/javascript" src="__LIB__/My97DatePicker/WdatePicker.js"></script>
<script>
    $(function () {
;

        $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });

        $("#form").Validform({
            tiptype: 2,
            ajaxPost: true,
            showAllError: true,
            callback: function (ret){
                ajax_progress(ret);
            }
        });
        //用户select2 js部分 start
        var route_id = $("#route_id").select2({
            language: "zh-CN", //设置 提示语言
            width: "100%", //设置下拉框的宽度
            theme: "classic"
        });
        var hotel_id = $("#hotel_id").select2({
            language: "zh-CN", //设置 提示语言
            width: "100%", //设置下拉框的宽度
            theme: "classic"
        });
        var hotel_room_type = $("#hotel_room_type").select2({
            language: "zh-CN", //设置 提示语言
            width: "100%", //设置下拉框的宽度
            theme: "classic"
        });

    })
</script>
<script>
    function getRoomType() {
        // console.log('选择的数据', $('#hotel_id   option:selected').val())
        var hotel_id = $('#hotel_id   option:selected').val();
        if (!hotel_id){
            layer.msg('未选择酒店');
            return false;
        }else{
            $('#hotel_room_type').empty();
        }
        $.ajax({
            type: 'POST',
            url: '/admin/hotel_accommodation/getRoomType',
            data: {hotel_id: hotel_id},
            success: function (ret) {
                console.log('ret', ret)
                if (ret.code == 1){
                    layer.msg(ret.msg)
                }else if (ret.code == 5){
                    var data = ret.data;
                    console.log('data', data);
                    var len = data.length;
                    if (len){
                        for (var i = 0; i < len; i++) {
                            $('#hotel_room_type').append("<option value='" + data[i].room_type_id + "'>" + data[i].room_name + "</option>")
                            $('#hotel_room_type option:eq(0)').attr('selected', 'selected');//选中第一个
                        }
                    }
                }
            }
        })
    }
</script>
{/block}